export type EventContainer = Window | HTMLElement | HTMLDocument;

export type EventDriverContainer = HTMLElement | HTMLDocument;

export interface IEventEffect<T> {
  (engine: T): void;
}

function applyEventEffect<T>(
  container: EventContainer,
  driverContainer: EventDriverContainer,
  effect: IEventEffect<T>
) {
  if (
    driverContainer instanceof HTMLElement ||
    driverContainer instanceof HTMLDocument
  ) {
    // 假设逻辑：在driverContainer上应用effect
    effect(container as T);
  } else {
    throw new Error(
      "EventDriverContainer must be an HTMLElement or HTMLDocument"
    );
  }
}

export default applyEventEffect;
